package com.ds.smartstudio.mapper;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ds.smartstudio.entity.Device;
import com.ds.smartstudio.controller.DTO.SearchValues;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.TreeSet;
import java.util.zip.DeflaterInputStream;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author yangsf
 * @since 2022-07-02 10:42:24
 */
@Mapper
public interface DeviceMapper extends BaseMapper<Device> {
    @Select("select count(ds_device_addr) from ds_device where ds_device_addr like '%'||#{name}||'%' and ds_device_status = 1")
    Integer selectTotalByName(String name);

    @Select("select ds_device_mac from ds_device")
    List<String> macs();

    @Select("select count(1) from ds_device where ds_device_status=1")
    Integer  getCount();


    @Select("select * from ds_device where ds_area_id = #{id} and ds_type_id like '%2%'")
    List<Device> tempDevice(Integer id);

////    My test01
    @Select("select ds_area_id from ds_device where ds_type_id like '%${id}%' ")
    HashSet<String> selectAreaIDByDeviceTypeID(@Param("id") Integer id);


}
